package zct.proj.pojo;

public class LogicSwitcher {

	public final static int M_NULL = 0;
	public final static int M_AND = 1;
	public final static int M_OR = 2;
	public final static int M_XOR = 3;
	public final static int M_ANDNOT = 4;
	public final static int M_ORNOT = 5;
	
	public static int getSwValue(int v1, int v2, int m) {
		int ret = -1;
		switch (m) {
		case M_AND:
			ret = v1 & v2;
			break;
		case M_OR:
			ret = v1 | v2;
			break;
		case M_XOR:
			ret = v1 ^ v2;
			break;
		case M_ANDNOT:
			ret = ~(v1 & v2);
			break;
		case M_ORNOT:
			ret = ~(v1 | v2);
			break;
		}
		return ret;
	}
	
	// 开关状态（高低电平）
	public int status;
	// 逻辑算法
	public int method;
	// 加入开关数量
	public int swCount;
	// 加入的开关
	public String[] swNames;
	// 开关是否取反
	public boolean[] useReserve;
}
